package com.example.springboot.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * 使用@WebListener注解，实现ServletContextListener接口
 *
 */
@WebListener
public class MyServletContextListener implements ServletContextListener {

	private static final Logger logger = LoggerFactory.getLogger(MyServletContextListener.class);
	
	@Override
	public void contextInitialized(ServletContextEvent sce) {
		// TODO Auto-generated method stub

		logger.debug("ServletContex初始化");
		logger.debug(sce.getServletContext().getServerInfo());
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub

		logger.debug("ServletContex销毁");
	}

}
